package cn.wolfcode.service.impl;

import cn.wolfcode.aspect.MyLog;
import cn.wolfcode.domain.Dept;
import cn.wolfcode.mapper.DeptMapper;
import cn.wolfcode.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> getAll() {
        return deptMapper.getAll();
    }

    @Override
    @MyLog
    public void delById(long id) {
           deptMapper.delById(id);
    }

    @Override
    @MyLog
    public void add(Dept dept) {
        deptMapper.add(dept);
    }

    @Override
    public Dept getById(long id) {
            return deptMapper.getById(id);
    }

    @Override
    @MyLog
    public void update(Dept dept) {
        dept.setUpdateTime(new Date());
        deptMapper.update(dept);
    }
}
